package org.example.controller.user;

import org.example.dao.commom.Result;
import org.example.dao.commom.ResultCode;
import org.example.dao.entity.user.AuRole;
import org.example.dao.entity.user.AuRolePermission;
import org.example.dao.entity.user.AuUserRole;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 22449
 */
@RestController
@RequestMapping("/user")
@CrossOrigin
public class RoleController {


    //TODO 新增
    /**
     * 添加角色(管理)
     */
    @PostMapping("/insertRole")
    public Result insertRole(@RequestBody AuRole uRole) {
        String name = uRole.getName();

        return null;
    }

    //TODO 查询

    /**
     * 查询角色列表(管理)
     */
    @PostMapping("/selectRoleList/{start}/{limit}")
    public Result selectRoleList(@PathVariable("start") Integer start,
                                 @PathVariable("limit") Integer limit) {
        return new Result(ResultCode.SUCCESS, null);
    }

    /**
     * 根据用户查询角色列表(管理)
     */
    @PostMapping("/selectRoleListByUser/{start}/{limit}")
    public Result selectRoleListByUser(@RequestBody AuUserRole auUserRole,
                                       @PathVariable("start") Integer start,
                                       @PathVariable("limit") Integer limit) {
        Long userId = auUserRole.getUserId();
        return new Result(ResultCode.SUCCESS, null);
    }

    /**
     * 根据权限查询角色(管理)
     */
    @PostMapping("/selectRoleByPermission")
    public Result selectRoleByPermission(@RequestBody AuRolePermission auRolePermission) {
        Long permissionId = auRolePermission.getPermissionId();
        return new Result(ResultCode.SUCCESS, null);
    }



    //TODO 更新

    /**
     * 更新角色名字(管理)
     */
    @PostMapping("/updateRole")
    public Result updateRole(@RequestBody AuRole uRole) {
        Long id = uRole.getId();
        String name = uRole.getName();

        return new Result(ResultCode.SUCCESS, null);
    }

    //TODO 删除

    /**
     * 删除角色(管理)
     */
    @PostMapping("/deleteRole")
    public Result deleteRole(@RequestBody AuRole uRole) {
        Long id = uRole.getId();
        return new Result(ResultCode.SUCCESS, null);
    }

    /**
     * 批量删除角色(管理)
     */
    @PostMapping("/deleteRoleList")
    public Result deleteRoleList(@RequestBody List<String> id) {

        return new Result(ResultCode.SUCCESS, null);
    }








}
